const TerserPlugin = require("terser-webpack-plugin");
module.exports = {
  productionSourceMap: false,
  devServer: {
    proxy: {
      "(/api|/homeimg|/favorite|/mp3|/animation|/avatar)": {
        target: "http://120.25.232.162",
      },
    },
    historyApiFallback: {
      index: "/index.html",
    },
    port: 9127,
    open: true,
  },
  optimization: {
    minimize: true,
    minimizer: [
      new TerserPlugin({
        parallel: true,
        terserOptions: {
          compress: {
            drop_console: true, //移除所有console相关代码；
            drop_debugger: true, //移除自动断点功能；
            pure_funcs: ["console.log", "console.error"], //配置移除指定的指令，如console.log,alert等
          },
          format: {
            comments: false,
          },
        },
        extractComments: false,
      }),
    ],
  },
};
